import { Base, Tuple } from "./Base";

enum UnitType {
    "英雄" = 1,
    "建筑" = 2,
    "生物" = 4
}

enum BarShowWay {
    "无显示" = 0,
    "显示玩家姓名" = 1,
    "显示单位名称" = 2
}

enum NameFont {
    "默认" = "DFPYuanW7-GB",
    "魏楷" = "HKWeiBeiW7",
    "雅黑" = "MSYH",
}

enum BloodBar {
    "无血条" = 0,
    "中号血条" = 65537,
    "大号血条" = 262148,
    "小号血条" = 524292,
    "简易血条" = 1048580,
    "塔防血条" = 262146,
    "经典血条" = 262147,
    "英雄血条" = 327681,
    "小兵血条" = 327682,
    "建筑血条" = 327683,
    "黄色血条" = 393217,
    "蓝色血条" = 393218,
    "绿色血条" = 393219,
    "橙色血条" = 393220,
    "紫色血条" = 393221,
    "青色血条" = 393222,
    "红色血条" = 393223,
    "银色血条" = 393224,
}

enum BooldShowType {
    "常驻显示" = 0,
    "血条不时显示" = 1
}

enum MpColor  {
    "蓝色" = "Blue",
    "黄色" = "Yellow",
    "红色" = "Red"
}


enum ViewType {
    "地面" = 0,
    "空中" = 1
}

enum BehaviourType {
    "无" = "",
    "警戒" = "caution",
    "原地防守" = "defense"
}

enum UnitStatus {
    "空" = 0,
    "禁止普攻" = 2 ** 1,
    "禁止施法" = 2 ** 2,
    "禁止移动" = 2 ** 3,
    "禁止转向" = 2 ** 4,
    "动画定帧" = 2 ** 5,
    "无法施加运动" = 2 ** 6,
    "无法被技能指示器锁定" = 2 ** 7,
    "无法被选中" = 2 ** 8,
    "隐身" = 2 ** 9,
    "无视静态碰撞" = 2 ** 10,
    "无视动态碰撞" = 2 ** 11,
    "不会死亡" = 2 ** 12,
    "无敌" = 2 ** 13,
    "无法控制" = 2 ** 14,
    "无法被攻击" = 2 ** 15,
    "Al无视" = 2 ** 16,
    "物理伤害免疫" = 2 ** 17,
    "魔法伤害免疫" = 2 ** 18,
    "负面魔法效果免疫" = 2 ** 19,
    "隐藏" = 2 ** 20,
    "无法被筛选器选中" = 2 ** 21,
}

enum MoveChannel {
    "地面" = 0,
    "空中" = 1
}


enum MoveLimit0 {
    "无" = 0,
    "陆地" = 1,
    "物件" = 2,
    "海洋" = 4,
}

enum MoveLimit1 {
    "无" = 0,
    "空中" = 1
}

enum CommonAtkType {
    "近战" = 0,
    "远程" = 1,
    "自定义" = 2,
    "空" = 99
}


/**
 * 单位物编
 */
export class Unit extends Base {
    /**通用 */
    /**
     * 单位类型
     */
    public type = UnitType.英雄
    /**
     * 头顶名称显示方式
     */
    public bar_show_name = BarShowWay.显示单位名称

    /**
     * 头顶名称字体
     */
    public billboard_name_font = NameFont.默认

    /**
     * 鼠标悬浮到单位后是否显示单位的名称和等级的文本框
     */
    public show_y3_extra_info = false

    /**
     * 血条样式
     */
    public blood_bar = BloodBar.中号血条

    /**
     * 血条显示模式
     */
    public blood_show_type = BooldShowType.常驻显示

    /**
     * 是否有技能资源条
     */
    public has_mp = true

    /**
     * 技能资源名称 自定义字符串
     */
    public mp_key = "MP"

    /**
     * 技能资源条颜色 英雄
     */
    public mp_color = "Blue"


    /**
     * 视野类型
     */
    public view_type = ViewType.地面

    /**
     * 是否在小地图显示
     */
    public is_mini_map_show = true

    /**
     * 是否强制在小地图显示
     */
    public force_show_on_mini_map = false

    /**
     * 是否使用简易小地图头像 
     */
    public use_simple_mini_map_icon = false

    /**
     * 自定义小地图头像 与 简易小地图头像选一个
     */
    public mini_map_icon = 106742

    /**
     * 小地图头像缩放
     */
    public mini_map_icon_scale = 1.0

    /**
     * 死亡后是否销毁 建筑
     */
    public destroy_after_die = false

    /**
     * 尸体消失时间 死亡后多长时间销毁  建筑
     */
    public keep_dead_body_time = 0.0

    /**
     * 默认行为
     */
    public default_behaviour_type = BehaviourType.警戒

    /**
     * 目标超出警戒范围后 是否仍然保持目标
     */
    public keep_target = true

    /**
     * 警戒时受到伤害且无法反击时 是否自动逃跑
     */
    public can_flee = true

    /**
     * 前置条件列表
     */
    public precondition_list: Tuple

    /**
     * 是否开启透视
     */
    public is_open_Xray = false

    /**属性 */
    /**
     * 转身速度
     */
    public rotate_speed = 9.42

    /**
     * 离地高度
     */
    public model_height = 0.0

    /**
     * 转向时移动速度系数
     */
    public speed_ratio_in_turn = 0.6

    /**
     * 转向补正 转向角度小于该值 速度不受影响
     */
    public angle_tolerance = 1

    /**
     * 击杀奖励 经验
     */
    public reward_exp = 5

    /**
     * 击杀奖励 金币
     */
    public reward_official_res_1 = 0.0

    /**
     * 单位等级
     */
    public level = 1

    /**
     * 单位碰撞半径
     */
    public dynamic_collision_r = 1.0

    /**
     * 单位状态 UnitStatus 相加后的结果
     * 
     * UnitStatus.禁止普攻 + UnitStatus.禁止施法
     */
    public ori_bits = UnitStatus.空

    /**
     * 物品栏格子数量
     */
    public bar_slot_size = 6

    /**
     * 背包栏格子数量
     */
    public pkg_slot_size = 0

    /**
     * 警戒范围
     */
    public alarm_range = 8.0

    /**
     * 取消警戒范围
     */
    public cancel_alarm_range = 10.0

    /**
     * 掉落物品列表
     */
    public drop_items_tuple: Tuple

    /**
     * 移动类型
     */
    public move_channel = MoveChannel.地面

    /**
     * 移动类型的限制通道 MoveLimitx 相加后的结果
     * move_channel = 0 则是MoveLimit0
     * move_channel = 1 则是MoveLimit1
     */
    public move_limitation = 1





    /**单位属性 */
    /**
     * 最大生命值
     */
    public hp_max = 1000.0
    public hp_max_grow = 100.0

    /**
     * 最大技能资源
     */
    public mp_max = 600.0
    public mp_max_grow = 50.0


    /**
     * 生命恢复
     */
    public hp_rec = 10
    public hp_rec_grow = 1

    /**
     * 技能资源恢复
     */
    public mp_rec = 10
    public mp_rec_grow = 2


    /**
     * 物理攻击
     */
    public attack_phy = 100.0
    public attack_phy_grow = 2.0

    /**
     * 魔法攻击
     */
    public attack_mag = 0.0
    public attack_mag_grow = 0.0

    /**
     * 物理防御
     */
    public defense_phy = 10.0
    public defense_phy_grow = 5.0

    /**
     * 魔法防御
     */
    public defense_mag = 0.0
    public defense_mag_grow = 0.0

    /**
     * 攻击速度%
     */
    public attack_speed = 100.0
    public attack_speed_grow = 0.0


    /**
     * 冷却缩减%
     */
    public cd_reduce = 0.0
    public cd_reduce_grow = 0.0

    /**
     * 命中率%
     */
    public hit_rate = 100.0
    public hit_rate_grow = 0.0

    /**
     * 闪避率%
     */
    public dodge_rate = 0.0
    public dodge_rate_grow = 0.0

    /**
     * 暴击率%
     */
    public critical_chance = 0.0
    public critical_chance_grow = 0.0

    /**
     * 暴击伤害%
     */
    public critical_dmg = 200.0
    public critical_dmg_grow = 0.0

    /**
     * 物理穿透
     */
    public pene_phy = 0.0
    public pene_phy_grow = 0.0


    /**
     * 法术穿透
     */
    public pene_mag = 0.0
    public pene_mag_grow = 0.0

    /**
     * 物理吸血%
     */
    public vampire_phy = 0.0
    public vampire_phy_grow = 0.0


    /**
     * 法术吸血%
     */
    public vampire_mag = 0.0
    public vampire_mag_grow = 0.0

    /**
     * 物理穿透%
     */
    public pene_phy_ratio = 0.0
    public pene_phy_ratio_grow = 0.0

    /**
     * 法术穿透%
     */
    public pene_mag_ratio = 0.0
    public pene_mag_ratio_grow = 0.0



    /**
     * 伤害减免
     */
    public dmg_reduction = 0.0
    public dmg_reduction_grow = 0.0

    /**
     * 所有伤害加成%
     */
    public extra_dmg = 0.0
    public extra_dmg_grow = 0.0

    /**
     * 被治疗效果加成%
     */
    public healing_effect = 0
    public healing_effect_grow = 0

    /**
     * 移动速度
     */
    public ori_speed = 2.0
    public ori_speed_grow = 0.0


    /**
     * 真实视野
     */
    public vision_true = 0.0
    public vision_true_grow = 0

    /**
     * 白天视野
     */
    public vision_rng = 10.0
    public vision_rng_grow = 0

    /**
     * 夜晚视野
     */
    public vision_night = 8.0
    public vision_night_grow = 0

    /**
     * 攻击间隔
     */
    public attack_interval = 1
    public attack_interval_grow = 0
    
    /**
     * 攻击范围
     */
    public attack_range = 10
    public attack_range_grow = 0


    /**
     * 扇形视野白天半径
     */
    public vision_sector_rng = 0
    public vision_sector_rng_grow = 0

    /**
     * 扇形视野夜晚半径
     */
    public vision_sector_night = 0
    public vision_sector_night_grow = 0

    /**
     * 扇形视野白天夹角
     */
    public vision_sector_angle_day = 0
    public vision_sector_angle_day_grow = 0

    /**
     * 扇形视野夜晚夹角
     */
    public vision_sector_angle_night = 0
    public vision_sector_angle_night_grow = 0


    /**
     * 敏捷
     */
    public agility = 10.0
    public agility_grow = 1.0

    /**
     * 智力
     */
    public intelligence = 10.0
    public intelligence_grow = 1.0

    /**
     * 力量
     */
    public strength = 10.0
    public strength_grow = 1.0

    /**
     * 恢复力
     */
    public resilience = 0.0
    public resilience_grow = 0.0
    
    /**
     * 
     */
    public gainvalue = 0.0
    public gainvalue_grow = 0.0

    public heal_effect = 0.0
    public heal_effect_grow = 0.0

    

    /**技能 */
    /**
     * 通用技能
     */
    public common_ability_list: Tuple
    /**
     * 英雄技能
     */
    public hero_ability_list: Tuple
    /**
     * 被动技能 隐藏技能
     */
    public passive_ability_list: Tuple

    /**
     * 普通攻击类型 近战 远程 自定义
     */
    public common_atk_type = CommonAtkType.近战
    /**
     * 自定义普通攻击
     */
    public common_atk: Tuple

    /**商店 */
    /**
     * 是否作为商店
     */
    public is_shop = false
    /**
     * 出售的商品列表
     */
    public sell_list: Tuple
    /**科技 */
    /**
     * 可研发科技
     */
    public research_techs: Tuple
    /**
     * 应用科技
     */
    public affect_techs: Tuple

    /**建造 */
    /**
     * 建造资源消耗  建筑类
     */
    public build_res_cost_list: Tuple

    /**声音 */
    public sound_event_list: Tuple


    /**TODO */
    public icon = 106742
    public init_stock = 5
    public max_stock = 5
    public refresh_interval = 1.0


    public gold_coin = 100
    public silver_coin = 0
    public copper_coin = 0

    public content = "strength"
    public main_attr = "strength"

    public shop_camp_args = 3
    public shop_range = 10.0
    public shop_select = false
    public shop_sell_type = 0
    public buy_res_list: Tuple
    public sell_res_list: Tuple

    public dead_exp = 10
    public dead_money = 5

    public armor_type = 20000
    public attack_type = 10000

    public has_shield = true

    public start_rft = 1.0


    public bar_show_scale = true
    public base_color_mod = 1
    public base_tint_color: Tuple
    public body_size = 1.0
    public collision_box_turning_enable = false
    public collision_points: Tuple

    public is_apply_role_color = true
    public is_open_outline_pass = false
    public kv = {}

    public model = 200766
    public model_opacity = 1
    public move_type = 40
    public role_color_scale = 1.0
   
    public simple_common_atk: Tuple
    public standard_walk_rate = 36.0
    
    public use_base_tint_color = false
    
    public idle_anim = "idle1"
    public special_idle_anim = "idle2"
    public walk_anim = "walk"
    public die_anim = "die"

}